Repository navigation
Conversation
Scope message cursors to their issuing Hub instance so a retained cache can recover after an explicit replacement connection. Return full snapshots for legacy numeric-only readers and pass instance IDs through both message consumers.
|
@SaKaNa-Y is attempting to deploy a commit to the NuxtLabs Team on Vercel. A member of the Team first needs to authorize it. |
|
👁️🗨️ Review this pull request with grouped, summarized diffs at: raw result💭 analyzed by {
"headSha": "e3c8ee5ab9f81fb3eaec3fd0de5ebd84dbc5b928",
"result": {
"overallSummary": "Fixes a bug where a reader reconnecting to a restarted Hub instance could reuse a stale numeric message cursor and either miss removals or keep showing old messages. The Hub now stamps each `listSince` result with its instance ID so readers can detect a foreign/expired cursor and fall back to a full snapshot, while the hub-ui isolates message state, toasts, and the standalone dock shell per connection so a replaced connection doesn't leak stale UI state into the new one.",
"groups": [
{
"key": "cursor-core",
"label": "Instance-aware message cursor",
"summary": "The Hub now tags every `listSince` result with its instance ID so a reader can tell whether a cursor belongs to the connection it just received, falling back to a full snapshot on a foreign or expired cursor. The `list` RPC keeps a per-connection fallback cursor so legacy numeric-only readers on the same connection can still receive removal deltas across overlapping reads.",
"category": "api",
"filePaths": [
"packages/hub/src/node/host-messages.ts",
"packages/hub/src/types/messages.ts",
"plugins/messages/src/node/rpc/functions/list.ts",
"plugins/messages/app/client/state/messages.ts"
],
"critical": true,
"fileNotes": [
{
"path": "packages/hub/src/node/host-messages.ts",
"text": "`listSince` now requires the caller's `instanceId` to match the host's own; any mismatch, missing ID, or stale version forces a full snapshot."
},
{
"path": "plugins/messages/src/node/rpc/functions/list.ts",
"text": "Caches the first snapshot cursor per RPC peer so a client that keeps calling with only `since` (no instanceId) still sees removals that happened on its own connection."
}
]
},
{
"key": "hub-ui-isolation",
"label": "Hub-UI per-connection message state",
"summary": "Message feeds and toasts were module-level singletons, so a reconnect to a new Hub instance leaked stale toasts/selection into the new connection. Each connection now gets its own toast store and message state keyed by its RPC client, a full snapshot from a different instance discards old entries, and the standalone dock shell remounts when its context changes so a toast click opens the panel on the right connection.",
"category": "ui",
"filePaths": [
"packages/hub-ui/src/client/state/messages.ts",
"packages/hub-ui/src/client/state/toasts.ts",
"packages/hub-ui/src/client/components/display/ToastOverlay.vue",
"packages/hub-ui/src/client/components/dock/DockStandalone.vue",
"packages/hub-ui/src/client/components/dock/DockStandaloneShell.vue"
],
"critical": true,
"fileNotes": [
{
"path": "packages/hub-ui/src/client/state/toasts.ts",
"text": "Replaces the single global toast list with a `createToastStore()` factory, one instance per connection."
},
{
"path": "packages/hub-ui/src/client/components/dock/DockStandalone.vue",
"text": "Logic moved into the new `DockStandaloneShell.vue`; this wrapper now just forces a remount (via an incrementing `:key`) whenever `context` changes."
}
]
},
{
"key": "tests",
"label": "Tests for message cursor fix",
"summary": "Covers the new instance-ID handling in `listSince`, legacy numeric-only reader fallbacks, per-connection message/toast state isolation, and updates the toast store stories to the new factory API.",
"category": "tests",
"filePaths": [
"packages/hub/src/node/__tests__/host-messages.test.ts",
"plugins/messages/test/dev-server.test.ts",
"plugins/messages/test/message-state.test.ts",
"packages/hub-ui/src/client/state/messages.test.ts",
"packages/hub-ui/src/client/state/toasts.test.ts",
"packages/hub-ui/src/client/components/display/ToastOverlay.stories.ts"
]
},
{
"key": "docs",
"label": "Hub API docs",
"summary": "Documents the new `listSince(version, instanceId)` contract, including fallback behavior for missing/foreign instance IDs and numeric-only callers.",
"category": "docs",
"filePaths": [
"docs/content/8.references/6.hub-api.md"
]
},
{
"key": "snapshots",
"label": "Generated type snapshots",
"summary": "Regenerated public API snapshots reflecting the new `instanceId` parameter and field added to the messages types and RPC signature.",
"category": "other",
"filePaths": [
"tests/__snapshots__/tsnapi/@devframes/hub/index.snapshot.d.ts",
"tests/__snapshots__/tsnapi/@devframes/hub/node.snapshot.d.ts",
"tests/__snapshots__/tsnapi/@devframes/hub/node.snapshot.js",
"tests/__snapshots__/tsnapi/@devframes/hub/types.snapshot.d.ts",
"tests/__snapshots__/tsnapi/@devframes/plugin-messages/rpc.snapshot.d.ts"
]
}
],
"schemaVersion": 1,
"source": "llm",
"generatedAt": "2026-11-22T07:04:51.997Z",
"model": "vercel-ai-gateway/anthropic/claude-sonnet-5",
"locale": "en"
}
} |
Keep the feed, toast timers and message selection with their RPC client. On a full snapshot from another Hub instance, drop the previous entries and notifications before applying the new list in order.
Keep the toast, dock selection, trust subscription and iframe panes on the same connection when a mounted viewer receives a replacement context.
Keep the first full snapshot cursor for each legacy connection. A new connection starts from a snapshot, while overlapping reads on the same connection can still observe an ID removed and added again.
The legacy Messages panel starts with list() and sends only the version on its next read. Remember the first snapshot for that peer so an ID removed and reused between reads appears in the delta.
SaKaNa-Y
marked this pull request as ready for review
November 22, 2026 07:13
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A reader that connects to a restarted Hub can keep old messages and miss new ones when both instances reach the same numeric version. A mounted standalone viewer can also show a notification from its new connection while the visible panel still belongs to the first connection.
The Hub includes its instance ID in each list result. The messages panel and Hub UI return that ID with their next read.
A replacement connection gets its own message list, selection, toasts and timers. Replacing a standalone viewer’s context also remounts its dock shell, so clicking a toast opens the panel on the same connection. On a full snapshot from a different instance, the UI drops old notifications and rebuilds the feed in snapshot order. A full refresh from the same instance preserves surviving notifications.
Evidence
list(), its nextlist(version)used to return another full snapshot. It now returns the removal and the replacement entry when the Hub reuses a message ID. The older Hub UI starts withlist(null)and receives the same removal across overlapping reads. A fresh connection that sends only a version still gets a full snapshot.Merge Danger
Door: two-way
Blast Radius: message-sync
Direct numeric-only
listSincecalls receive full snapshots. The live messages RPC can serve deltas to older readers after establishing a snapshot on their connection. Older results and static snapshots may omit the instance ID. Connection replacement remains explicit.